﻿using GalaSoft.MvvmLight;
using System.Collections.Generic;
using System.ComponentModel;

namespace SpringPad.ViewModel
{
    /// <summary>
    /// This class contains properties that the main View can data bind to.
    /// <para>
    /// Use the <strong>mvvminpc</strong> snippet to add bindable properties to this ViewModel.
    /// </para>
    /// <para>
    /// You can also use Blend to data bind with the tool's support.
    /// </para>
    /// <para>
    /// See http://www.galasoft.ch/mvvm
    /// </para>
    /// </summary>
    public class MembreVM : ViewModelBase
    {
        public class Membre : INotifyPropertyChanged
        {
            private string _pseudoP;

            public string pseudo
            {
                get { return _pseudoP; }
                set { _pseudoP = value; RaiseProperyChangedEvent("pseudo"); }
            }

            private string _tokenUserP;

            public string tokenUser
            {
                get { return _tokenUserP; }
                set { _tokenUserP = value; RaiseProperyChangedEvent("tokenUser"); }
            }



            protected void RaiseProperyChangedEvent(string property)
            {
                if (PropertyChanged != null)
                {
                    PropertyChanged(this, new PropertyChangedEventArgs(property));
                }
            }
            public event PropertyChangedEventHandler PropertyChanged;
        }

        private Membre _membreP;

        public Membre membre
        {
            get { return _membreP; }
            set { _membreP = value; RaisePropertyChanged("membre"); }
        }

        private bool _isLoggedInP;

        public bool isLoggedIn
        {
            get { return _isLoggedInP; }
            set { _isLoggedInP = value; RaisePropertyChanged("isLoggedIn"); }
        }
        

        public MembreVM()
        {
            
	

            if (IsInDesignMode)
            {
                membre.pseudo = "RBeuque74";
                membre.tokenUser = "abcd1234";
            }

        }

        public bool loginUser()
        {
            if (!isLoggedIn)
            {
                // loader les data from OAuth
                /*
                 * Consumer Key	b326e4fa6caf4ca38bb4eb0fb46406f5
                 * Consumer Secret	cc64db0c041542a39df0b3bc169debd5
                 * Request Token URL	http://springpadit.com/api/oauth-request-token
                 * Access Token URL	http://springpadit.com/api/oauth-access-token
                 * Authorize URL	http://springpadit.com/api/oauth-authorize
                 * */
                return true;
            }
            else { return true; }
        }
    }
}